package net.cherrylab.war.view
{
	import flash.events.Event;
	import flash.geom.Point;
	
	import mx.core.UIComponent;
	
	import spark.components.Group;
	import spark.components.Label;
	[Bindable]
	public class HexagonGrid extends Group
	{
		private var _code:String="00";
		private var _isLabel:Boolean=true;
		private var codeLabel:Label=new Label();
		private var _radiusV:Number;
		private var _radiusH:Number;
		public var ui:UIComponent;
		private var _signX:int;
		private var _signY:int;
		public function HexagonGrid(_radius:Number)     //参数为半径
		{
			super();
			//获得半径属性
			_radiusH=_radius;
			_radiusV=Math.sin(Hexagon.ANGLE)*_radiusH;
			//绘制六边形
			ui=new UIComponent();
			
			
			/*var hexagon:Hexagon=new Hexagon(_radiusH);
			ui.addChild(hexagon);	*/
			//添加标签
		    codeLabel.text=_code;
			codeLabel.right=_radiusH*0.5+2;
			//codeLabel.x=_radiusH*1.5-15;        //hexagon.esp.x-15;
			codeLabel.y=_radiusV*2-12;              //hexagon.esp.y-12;
			this.addElement(ui);
			ui.x=0;
			ui.y=0;
			this.width=2*_radiusH;
			this.height=2*_radiusV;
			this.addElement(codeLabel);
			
		}
		//半径属性

		public function get signY():int
		{
			return _signY;
		}

		public function set signY(value:int):void
		{
			_signY = value;
		}

		public function get signX():int
		{
			return _signX;
		}

		public function set signX(value:int):void
		{
			_signX = value;
		}

		public function get radiusV():Number{
			return _radiusV;
		}
		public function get radiusH():Number{
			return _radiusH;
		}
		//编号属性
		public function get code():String {
			return _code;
		}
		public function set code(value:String):void {
			_code = value;
			codeLabel.text=_code;
		}
		//是否显示标签属性
		public function set isLabel(value:Boolean):void {
			_isLabel = value;
			codeLabel.visible=_isLabel;
		}
	}
}